package com.aididi.spring.config;

import com.aididi.spring.entity.BeanDemo;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @Auther: zx.xu
 * @Description:
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar{


    //选择性的进行注册Bean，注册时可以指定Bean名称，并且可以定义bean的级别
    @Override
    public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
        beanDefinitionRegistry.registerBeanDefinition("beanDemo3",new RootBeanDefinition(BeanDemo.class));
    }
}
